import random
def readprob(fname):
    l=open(fname,'r').readlines()
    res=[]
    for row in l:
        res.append([float(cc) for cc in row.rstrip().split(';')])
    return res

def randbet(p):
    random.seed()
    rp=random.random()
    if rp<=p[0]:return '1'
    elif (rp>=p[0])and(rp<=p[0]+p[1]): return'X'
    else: return '2'

def genbet(p):
    a=''
    for pp in p: a+=randbet(pp)
    return a

def sv(a,b):
    cnt=0
    for i in range(0,15):
        if a[i]==b[i]:cnt+=1
    return str(cnt)
def genbet2(p):
    a=''
    for i in range(15):
        a+=random.choice('12X')
    return a
#50.00; 1-(*); 2-(*); 3-(*); 4-(*); 5-(*); 6-(*); 7-(*); 8-(*); 9-(*); 10-(*); 11-(*); 12-(*); 13-(*); 14-(*); 15-(*).
def randchange(s):
    a=''
    c={k for k in  range(0,15)}
    for i in range(0,12):
        l=random.choice([cc for cc in c])
        c=c.difference({l})
    k=0
    for ss in s:
        if k in c: a+=random.choice('12x')
        else: a+=ss
        k+=1
    return a
def res(c):
    tmpl='50.00;1-(*);2-(*);3-(*);4-(*);5-(*);6-(*);7-(*);8-(*);9-(*);10-(*);11-(*);12-(*);13-(*);14-(*);15-(*).'
    for cc in c:
        tmpl=tmpl.replace('*',cc,1)
    return tmpl


